def calculate_grade(score):
    """根据分数计算等级"""
    if not isinstance(score, (int, float)):
        return "输入错误：请输入数字"
    
    if score < 0 or score > 100:
        return "分数错误：请输入0-100之间的数字"
    
    if score >= 90:
        return "优秀"
    elif score >= 80:
        return "良好"
    elif score >= 70:
        return "中等"
    elif score >= 60:
        return "及格"
    else:
        return "不及格"

if __name__ == "__main__":
    print("请输入分数进行测试（输入非数字可退出）：")
    while True:
        try:
            score_input = input("分数（0-100）：")
            score = float(score_input)
            grade = calculate_grade(score)
            print(f"等级：{grade}\n")
        except ValueError:
            print("输入非数字，程序结束。")
            break